<?php
if(!isset($_GET['id'])) {
?>
	<ul id="albumlist">
	<?php
	$count = 1;
	foreach($moduleData as $album)
	{
		$clear = (($count % 3) == 1) ? 'clear' : '';

		$id = substr($album['id'], 66, 19);
		
		$urlslug = Inflector::slug($album['title']['value']);
		echo "<li class=\"album {$clear}\"><a href=\"/fotos?album={$urlslug}&amp;id={$id}\"><img src=\"{$album['Group']['Thumbnail']['url']}\" alt=\"{$album['title']['value']}\" />{$album['title']['value']}</a></li>";
		$count ++;
	}
	?>
	<li class="clear">&nbsp;</li>
	</ul>
<?php
}
else {
?>
	<div id="photos">
	<?php
	echo "<h1>Album: {$moduleData['title']}</h1>";
	echo "<ul>";
	$count = 1;

	foreach($moduleData['Item'] as $photo)
	{
		$clear = (($count % 4) == 1) ? 'clear' : '';
		echo "<li class=\"photo {$clear}\"><a href=\"{$photo['Group']['Content']['url']}\"><img src=\"{$photo['Group']['Thumbnail'][1]['url']}\" alt=\"{$moduleData['title']}\" /></a></li>";
		$count ++;
	}
	?>
	<li class="clear">&nbsp;</li>
	</ul>
	</div>
<?php
}
?>